package com.tk.array;

//二维数组
public class Demo03 {
    public static void main(String[] args) {
        int[][] arrays = {{1, 2}, {2, 3}, {3, 4}};
        printArray(arrays[0]);

        System.out.println("arrays[1][1] = " + arrays[1][1]);

        System.out.println(arrays.length);

        System.out.println(arrays[0].length);

        for (int i = 0; i < arrays.length; i++) {
            for (int j = 0; j < arrays[i].length; j++) {
                System.out.print(arrays[i][j] + " ");
            }
        }
    }

    //打印数组元素
    public static void printArray(int[] arrays) {
        for (int i = 0; i < arrays.length; i++) {
            System.out.print(arrays[i] + " ");
        }
    }
}
